#include "..\..\std_lib_facilities.h"

vector<wstring> split(const wstring& wstr, const wstring& spliters)
{
	wistringstream istr(wstr);
	vector<wstring> *temps = new vector<wstring>;
	wchar_t wc;
	wstring temp;
	while (istr.get(wc))
	{
		if (spliters.find(wc)==wstring::npos&&!iswspace(wc))	
			temp+=wc;
		else
		{
			temps->push_back(temp);
			temp.clear();
		}
	}
	return *temps;
}

int main()
{
	locale loc = prepare_iostream();
	system("chcp 1251 > NUL");
	try
	{
		wstring str;
		getline(wcin, str);
		vector<wstring> result = split(str, L";,.*:-");
		for (size_t i = 0; i < result.size(); ++i)
			wcout << result[i] << endl;
		
		system("pause");
		return 0;
	}
	catch (exception& e)
	{
		wcerr << e.what() << endl;
		return 1;
	}
	catch(...)
	{
		wcerr << L"Uncnown exception..." << endl;
		return 2;
	}

}